<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>迭代器和生成器</title>
</head>
<body>
    <script>
        // 可迭代对象
        let arr = ['foo', 'bar'];
        // 迭代器工厂函数
        console.log(arr[Symbol.iterator]);
        // 迭代器   迭代器工厂函数执行生成迭代器
        let iter = arr[Symbol.iterator]();
        console.log(iter);

        console.log(iter.next());
        console.log(iter.next());
        console.log(iter.next());
    </script>
</body>
</html>